const crypto = require('crypto');

const md5 = require('./md5');

let str = `_key=CykdY1StU8t9EAvNQTlh613BUeLoSXgNS9EAYnKghmNcDvM8ePtisYHaWZyNE2d58GNhm8YeJ324NWW6mo3eg0QYCofezpkmCMibALwSjUJ6EmztPaekBRe3XQSoQIBi&_timestamp=1724822226267&_nonce=30b13e0329ad4644af3eb442b2ab9f87,amapLocation=113.81253694586249,22.691109386232462&bookingTypes=&industryTypes=1&mapIds=107292,105110,105218,105213&pageNumber=2&pageSize=10&professional=&searchKey=&searchType=2&sortType=2&t=1724822214979,,,`;

let val = crypto.createHash('md5').update(str).digest('hex').slice(0, 32).toUpperCase();

let val2 = md5(str).toUpperCase();

console.log(val, val2, val === val2);   
// cd8133cb5599eb3a9c2c64d41e3cae6d
// 1BBD4D49F64A9CB4555515E1CED62706
// 96063356af0f4221f34687fff9d4eefa


const signature = require('../src/utils/signature');
const axios = require('axios');

let ts = new Date().getTime();
// let url = `https://isz.ydmap.cn/srv100352/api/pub/sales/getSalesListByPage?amapLocation=113.81254935641894,22.691118194683902&bookingTypes=&industryTypes=1&mapIds=107292,105110,105218,105213&pageNumber=1&pageSize=10&professional=&searchKey=&searchType=2&sortType=2&t=${ts}`;
let url = `https://isz.ydmap.cn/srv100352/api/pub/sales/getSalesListByPage?searchKey=&bookingTypes=&professional=&amapLocation=113.81254935641894,22.691118194683902&searchType=2&sortType=2&industryTypes=1&mapIds=107292,105110,105218,105213&pageNumber=1&pageSize=10&t=${ts}`;
let sign = signature(url);

axios.get(url, {headers: sign}).then(response => console.log(response.data));

// amapLocation=113.81254935641894,22.691118194683902&bookingTypes=&industryTypes=1&mapIds=107292,105110,105218,105213&pageNumber=1&pageSize=10&professional=&searchKey=&searchType=2&sortType=2&t=1724823115047,,,
// searchKey=&bookingTypes=&professional=&amapLocation=113.81254935641894,22.691118194683902&searchType=2&sortType=2&industryTypes=1&mapIds=107292,105110,105218,105213&pageNumber=1&pageSize=10&t=1724823234172,,,
